package com.xyzwps.paimon.furina.common

import kotlinx.datetime.*
import java.time.format.DateTimeFormatter

object DateTimeUtil {
    private val zone = TimeZone.currentSystemDefault()

    fun currentLocalDateTime(): LocalDateTime = Clock.System.now().toLocalDateTime(zone)

    fun currentTsSeconds(): Long = Clock.System.now().epochSeconds

    fun format(dateTime: LocalDateTime): String =
        DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(dateTime.toJavaLocalDateTime());

    fun parseLocalDateTime(str: String): LocalDateTime = LocalDateTime.parse(str)
}